// ucenter/pages/ucenter/personcenter/editdetails/circleinteraction/circleenergy/circledatadetails/circledatadetails.js
const util = require('../../../../../../../../utils/util.js'); // 引入
Page({

  /**
   * 页面的初始数据
   */
  data: {
    startDateText:'',//默认当前日期用于展示
    endDateText: '',//默认当前日期用于展示
    startDate:'开始时间',
    endDate:'结束时间',
    jinricheck:false,//是否点击今日
    quanchengcheck:false,//是否点击全程
    jinritext:'huisetext',//今日样式
    quanchengtext:'huisetext',//全程式样
    jinriview:'huiseview',
    quanchengview:'huiseview',
    active: 1,//折叠版
    color_tabs0: '#FE8A28',//折叠版样式
    color_tabs1: '#888888',//折叠版样式
    touxiang:'https://wx.qlogo.cn/mmopen/vi_32/ibxY8SN6ASl4PoxbFHAicQqoLtE39kH7DSapf0KibE8LaoSPeSwk4rUMs6U0icRpu5HcDsL9V8Uyhpa8eJiceX4eMnQ/132',
    xingbie:'https://image.xingqubaike.com:8443/minicard/ucenter/personcenter/circleenergy/circledatadetails/06-00nanxing.png'
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var times = util.formatTime(new Date());
    var date = times.substring(0, 10);
    this.setData({
      startDateText: date,
      endDateText: date
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  },
  /*tabs切换 */
  tabsChange(event) {
    let that = this;
    var index = event.detail.index;
    switch (index) {
      case 0:
        that.setData({
          color_tabs0: '#FE8A28',
          color_tabs1: '#888888',
          tabsActive: index
        })
        break;
      case 1:
        that.setData({
          color_tabs0: '#888888',
          color_tabs1: '#FE8A28',
          tabsActive: index
        })
        break;
    }
  },
  cheakjinri:function(){
    if (!this.data.jinricheck){
      this.setData({
        jinriview: 'huangseview',
        jinritext: 'huangsetext',
        jinricheck:true
      })
    }else{
      this.setData({
        jinriview: 'huiseview',
        jinritext: 'huisetext',
        jinricheck: false
      })
    }
  },
  cheakquancheng: function () {
    if (!this.data.quanchengcheck){
      this.setData({
        quanchengview: 'huangseview',
        quanchengtext: 'huangsetext',
        quanchengcheck:true
      })
    }else{
      this.setData({
        quanchengview: 'huiseview',
        quanchengtext: 'huisetext',
        quanchengcheck: false
      })
    }
  },
  startdateChange: function (e) {
    var currPage = this;
    this.setData({
      startDate: e.detail.value,
      endDate: e.detail.value,
      startDateText: e.detail.value,
      endDateText: e.detail.value
    })
  },
  enddateChange: function (e) {
    var currPage = this;
    this.setData({
      startDate: e.detail.value,
      endDate: e.detail.value,
      startDateText: e.detail.value,
      endDateText: e.detail.value
    })
  }
})